package com.nc.shop.service.controller;

import com.nc.shop.service.dao.ShopDao;
import com.nc.shop.service.model.entity.ClassifyEntity;
import com.nc.shop.service.model.entity.ShopEntity;
import com.nc.shop.service.service.ShopService;
import com.plug.result.ReqPage;
import com.plug.result.RetResponse;
import com.plug.result.RetResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 创建人:    xvzhe
 * 创建时间:
 * 修改时间:
 * 版本:      v1.0
 */
@RestController
@RequestMapping("ShopController")
@Api
public class ShopController {
    @Autowired
    ShopDao shopDao;
    @Autowired
    ShopService shopService;

    @PostMapping("shop")
    @ApiOperation("保存商品")
    public RetResult postClassify(@RequestBody ShopEntity shopEntity) {
        shopDao.save(shopEntity);
        return RetResponse.makeOKRsp();
    }

    @PostMapping("getShop")
    @ApiOperation("商品列表")
    public RetResult getClassify(@RequestBody ReqPage reqPage) {
        return shopService.findPage(reqPage);
    }
}
